package top.v5it.japi.ddd.example.account.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import top.v5it.japi.ddd.core.entity.Entity;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.time.LocalDateTime;
import java.time.ZoneId;

/**
 * @author zhanpu
 * @date 2023/3/8
 */
@Setter
@Getter
@Accessors(chain = true)
public class Account extends Entity<Long> {

    private static final long serialVersionUID = -7140763218057189960L;
    private Long id;
    @NotBlank(message = "用户编号不能为空")
    private String user_id;
    @NotNull(message = "金额不能为空")
    @Positive(message = "金额不能为负数")
    private Long money;
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
    private LocalDateTime create_time = LocalDateTime.now(ZoneId.systemDefault());
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
    private LocalDateTime update_time = LocalDateTime.now(ZoneId.systemDefault());
}
